package com.czxy.demo01;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by hp on 2020/1/31.
 */
public class Test13 {
    public static void main(String[] args) {
        Employee e1 = new Employee("小明",1800);
        Employee e2 = new Employee("小新",2600);
        List<Employee> list = new ArrayList<>();
        list.add(e1);
        list.add(e2);
        for (Employee e : list) {
            if (e.getName().equals("小明")){
                e.setSalary(e.getSalary()+300);
            }
        }
        for (Employee ee : list) {
            System.out.println("姓名:"+ee.getName()+"---工资:"+ee.getSalary());
        }
    }
}
